package br.com.fromtis.jsf.modal.entity;
import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;





@Getter
@Setter
@EqualsAndHashCode( of = { "id" } )
@Entity
@Inheritance( strategy = InheritanceType.JOINED )
public abstract class Cliente implements Serializable {
	
	
	/**
     * 
     */
    private static final long serialVersionUID = 758687423773391507L;

	@Id
	@GeneratedValue
	@Column( name = "ID" )
	private Integer id;
	
	@Column( name = "CLIENTE_EMAIL" )
	private String email;
	
	@OneToOne( cascade = CascadeType.ALL )
	@JoinColumn( name = "ENDERECO_ID", unique = true, nullable = false )
	private Endereco endereco;
	
	@OneToMany( cascade = CascadeType.ALL,fetch=FetchType.EAGER )
	@JoinColumn( name = "CLIENTE_ID" )
	private List<Telefone> telefones;
}
